graph = ["digraph{", "concentrate=true;"]
ips = []
STDIN.readlines[1..-1].each do |line|
	line = line.strip.split(',').map{|x| x[1..-2]}
	if line[6].include? "Who has"
		ips << '"' + line[6][/[0-9]+.[0-9]+.[0-9]+.[0-9]+$/] + "\" -> \"" + line[6][/[0-9]+.[0-9]+.[0-9]+.[0-9]+/] + '"'
	end
end
graph += ips.sort.uniq
graph << "}"
puts graph.join "\n"